<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>选择器</title>
</head>
<body>
<div class="box">盒子1</div>
<div class="box">盒子2</div>
<div id="nav">
  <ul>
    <li>首页</li>
    <li>产品</li>
  </ul>
</div>
<script>
  // 2. querySelector 返回指定选择器的第一个元素对象  切记 里面的选择器需要加符号 .box  #nav
  const firstBox = document.querySelector('.box'); //class类名
  console.log(firstBox);
  const nav = document.querySelector('#nav'); //id
  console.log(nav);
  const li = document.querySelector('li');//标签
  console.log(li);
</script>
</body>
</html>
